use craftdig_math::{BlkCoord, ChunkCoord};

use super::map;
use crate::block;
use crate::entity::{EntityId, EntityState};

/// Read-only view of a live world.
pub trait WorldView {
    /// Gets the ID of a block, by block coord.
    fn get_block_id(&self, coord: BlkCoord) -> Option<block::BlkId>;

    /// Gets a ref to a whole chunk's data, by chunk coord.
    fn get_chunk_ref(&self, coord: ChunkCoord) -> Option<&map::ChunkState>;

    /// Gets an entity's state.
    fn get_entity_state(&self, eid: &EntityId) -> Option<&EntityState>;

    /// Iterates over existing entities in any order.
    fn get_entity_ids(&self) -> Vec<EntityId>;
}
